#!/usr/bin/env python
#-*- coding:utf-8 -*-

import gtk
import gtk.glade

from wordpath import *
from welcome import Welcome
from choose import ChooseGrade
#from about import About
from recite import Recite
# from newword import NewWord
# from result import Result
# from revise import Revise

class WordJoy:
    def __init__(self):
        self.glade_file = GLADE_PATH + "wordjoy.glade"
        self.wTree = gtk.glade.XML(self.glade_file)

        self.wordjoy_window = self.wTree.get_widget ("wordjoy_window")

        events_dic ={ "on_wordjoy_window_destroy":gtk.main_quit,
                      "on_label_quit_button_press_event":gtk.main_quit}

        self.wTree.signal_autoconnect(events_dic)

        self.sidebar = self.wTree.get_widget("sidebar_notebook")

        # 欢迎
        Welcome(self.wTree)

        # 选书
        ChooseGrade(self.wTree)

        # 单词初记(初始化)
        Recite(BOOK_PATH + "beginner/grade_1.xml", self.wTree)

        # 复习
        #Revise(self.wTree)
        
        # 自定义生词
        #NewWord(self.wTree)
        # 关于
#        About(self.wTree)

        # 成绩
        #Result(self.wTree)

def main():
    gtk.main()

if __name__ == '__main__':
    WordJoy()
    main()
